{template '_header'}

<style>
    .popover{
        width:170px;
        font-size:12px;
        line-height: 21px;
        color: #0d0706;
    }
    .popover span{
        color: #b9b9b9;
    }
    .nickname{
        display: inline-block;
        max-width:200px;
        overflow: hidden;
        text-overflow:ellipsis;
        white-space: nowrap;
        vertical-align: middle;
    }
    .tooltip-inner{
        border:none;
    }
</style>
<div class="page-header"> 当前位置：<span class="text-primary">会员列表</span> </div>

<div class="page-content">

  <form action="./index.php" method="get" class="form-horizontal table-search" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="mx_shop" />
                <input type="hidden" name="do" value="web" />
                <input type="hidden" name="r" value="user.list" />
      <div class="page-toolbar">
            <span class="pull-left">
                {php echo tpl_daterange('time', array('sm'=>true, 'placeholder'=>'注册时间'),true);}
            </span>
          <div class="input-group">
                <span class="input-group-select">
                    <select name='followed' class='form-control'>
                        <option value=''>关注</option>
                        <option value='0' {if $_GPC['followed']=='0'}selected{/if}>未关注</option>
                        <option value='1' {if $_GPC['followed']=='1'}selected{/if}>已关注</option>
                        <option value='2' {if $_GPC['followed']=='2'}selected{/if}>取消关注</option>
                    </select>
                </span>
              <span class="input-group-select">
                    <select name='level' class='form-control'>
                        <option value=''>等级</option>
                        {loop $levels $level}
                            <option value="{$level['id']}" {if $_GPC['level']==$level['id']}selected{/if}>{$level['levelname']}</option>
                        {/loop}
                    </select>
                </span>

              <span class="input-group-select">
                    <select name='groupid' class='form-control'>
                        <option value=''>分组</option>
                        {loop $groups $group}
                            <option value="{$group['id']}" {if $_GPC['groupid']==$group['id']}selected{/if}>{$group['groupname']}</option>
                        {/loop}
                    </select>
                </span>

              <span class="input-group-select">
            <select name='isblack' class='form-control'>
                <option value=''>黑名单</option>
                <option value='0' {if $_GPC['isblack']=='0'}selected{/if}>否</option>
                <option value='1' {if $_GPC['isblack']=='1'}selected{/if}>是</option>
            </select>
                </span>

              <input type="text" class="form-control " name="realname" value="{$_GPC['realname']}" placeholder="可搜索昵称/姓名/手机号/ID">
              <span class="input-group-btn">
                    <button class="btn  btn-primary" type="submit"> 搜索</button>
                    <button type="submit" name="export" value="1" class="btn btn-success ">导出</button>
                </span>
          </div>
      </div>
  </form>


{if empty($list)}
<div class="panel panel-default">
    <div class="panel-body empty-data">未查询到相关数据</div>
</div>
{else}
<div class="row">
    <div class="col-md-12">
        <div class="page-table-header">
            <input type="checkbox">
            <div class="btn-group">
                {ifp 'user.list.edit'}
                <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('user/list/setblack',array('isblack'=>1))}">
                    <i class="icow icow-heimingdan2"></i>设置黑名单
                </button>
                <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('user/list/setblack',array('isblack'=>0))}">
                    <i class="icow icow-yongxinyonghu"></i> 取消黑名单
                </button>
                {/if}
                {ifp 'user.list.delete'}
                <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('user/list/delete')}">
                    <i class="icow icow-shanchu1"></i> 批量删除
                </button>
                {/if}
            </div>
        </div>
        <table class="table table-responsive">
            <thead class="navbar-inner">
            <tr>
                <th style="width:25px;"><input type='checkbox' /></th>
                <th style="width:250px;">粉丝</th>
                <th>等级/分组</th>
                <th>注册时间</th>
                <th>积分/余额</th>
                <th>成交</th>
                <th style="width:70px;">操作</th>
            </tr>
            </thead>
            <tbody>
            {loop $list $row}
            <tr>
                <td style="position: relative; ">
                    <input type='checkbox' value="{$row['id']}" class="checkone"/></td>
                <td style="overflow: visible">
                    <div rel="pop" style="display: flex"  data-content=" <span>ID: </span>{$row['id']} </br>
                                <span>推荐人：</span> {if empty($row['agentid'])}
                                  {if $row['isagent']==1}
                                      总店
                                      {else}
                                     暂无
                                      {/if}
                                {else}

                                {if !empty($row['agentavatar'])}
                                 <img src='{$row['agentavatar']}' style='width:20px;height:20px;padding1px;border:1px solid #ccc' />
                               {/if}
                               [{$row['agentid']}]{if empty($row['agentnickname'])}未更新{else}{$row['agentnickname']}{/if}
                               {/if}
                               <br/>
                                 <span>真实姓名：</span> {if empty($row['realname'])}未填写{else}{$row['realname']}{/if}
                                <br/>
                               <span>手机号：</span>{if !empty($row['mobileverify'])}{$row['mobile']}{else}未绑定{/if} <br/>
                               <span>是否关注：</span>{if empty($row['followed'])}
                            {if empty($row['unfollowtime'])}
                                <i>未关注</>
                            {else}
                                <i>取消关注</i>
                            {/if}
                        {else}
                            <i>已关注</i>
                        {/if} <br/>
                               <span>状态:</span>  {if $row['isblack']==1}黑名单{else}正常{/if} ">

                        <img class="img-40" src="{php echo tomedia($row['avatar'])}" style='border-radius:50%;border:1px solid #efefef;' onerror="this.src='../addons/mx_shop/static/images/noface.png'" />
                        <span style="display: flex;flex-direction: column;justify-content: center;align-items: flex-start;padding-left: 5px">
                                       <span class="nickname">
                                           {if strexists($row['openid'],'sns_wa')}<i class="icow icow-xiaochengxu" style="color: #7586db;vertical-align: middle;" data-toggle="tooltip" data-placement="top" title="" data-original-title="来源: 小程序"></i>{/if}
                                           {if strexists($row['openid'],'sns_qq')||strexists($row['openid'],'sns_wx')||strexists($row['openid'],'wap_user')}<i class="icow icow-app" style="color: #44abf7;vertical-align: top;" data-toggle="tooltip" data-placement="bottom" data-original-title="来源: 全网通({if strexists($row['openid'],'wap_user')}手机号注册{else}APP{/if})"></i>{/if}

                                           {if empty($row['nickname'])}未更新{else}{$row['nickname']}{/if}
                                       </span>
                                       {if $row['isblack']==1}
                                            <span class="text-danger">黑名单<i class="icow icow-heimingdan1"style="color: #db2228;margin-left: 2px;font-size: 13px;"></i></span>
                                       {/if}
                                   </span>

                    </div>
                </td>

                <td>{if empty($row['levelname'])}普通会员{else}{$row['levelname']}{/if}
                    <br/>{if empty($row['groupname'])}无分组{else}{$row['groupname']}{/if}
                </td>

                <td>{php echo date("Y-m-d",$row['createtime'])}<br/>{php echo date("H:i:s",$row['createtime'])}</td>
                <td><span >积分:  <span style="color: #5097d3">{php echo intval($row['credit1'])}</span> </span>
                    <br/><span>余额: <span class="text-warning">{php echo price_format($row['credit2'],2)} </span></span></td>

                <td><span>订单: {$row['ordercount']}</span>
                    <br/><span> 金额: <span class="text-warning">{php echo floatval($row['ordermoney'])}</span></span></td>
                <td style="overflow:visible;text-align: center;">

                    <div class="btn-group">
                        {ifp 'user.list.detail'}
                        <a class="btn  btn-op btn-operation" href="{php echo webUrl('user/list/detail',array('id' => $row['id']));}" title="">
                                            <span data-toggle="tooltip" data-placement="top" title="" data-original-title="会员详情">
                                                <i class='icow icow-bianji2'></i>
                                            </span>
                        </a>
                        {/if}
                        {ifp 'order.list'}

                        <a class="btn  btn-op btn-operation" href="{php echo webUrl('order/list', array('searchfield'=>'member','keyword'=>$row['nickname']))}"
                           title=''>
                                                   <span data-toggle="tooltip" data-placement="top" title="" data-original-title="会员订单">
                                                       <i class='icow icow-dingdan2'></i>
                                                    </span>
                        </a>
                        {/if}
                        {ifp 'finance.recharge.credit1'}
                        <a class="btn  btn-op btn-operation" data-toggle="ajaxModal"
                           href="{php echo webUrl('user/list/recharge', array('type'=>'credit1','id'=>$row['id']))}"
                           title=''>
                                                 <span data-toggle="tooltip" data-placement="top" title="" data-original-title="充值">
                                                   <i class='icow icow-31'></i>
                                                </span>
                        </a>
                        {/if}
                        {ifp 'user.list.delete'}
                        <a class="btn btn-op btn-operation" data-toggle='ajaxRemove' href="{php echo webUrl('user/list/delete',array('id' => $row['id']));}" data-confirm="确定要删除该会员吗？">
                                             <span data-toggle="tooltip" data-placement="top" title="" data-original-title="删除会员">
                                               <i class='icow icow-shanchu1'></i>
                                            </span>
                        </a>
                        {/if}
                    </div>
                </td>
            </tr>
            {/loop}
            </tbody>
            <tfoot>
            <tr>
                <td><input type="checkbox"></td>
                <td colspan="3">
                    <div class="btn-group">
                        {ifp 'user.list.edit'}
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('user/list/setblack',array('isblack'=>1))}">
                            <i class="icow icow-heimingdan2"></i>设置黑名单
                        </button>
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('user/list/setblack',array('isblack'=>0))}">
                            <i class="icow icow-yongxinyonghu"></i> 取消黑名单
                        </button>
                        {/if}
                        {ifp 'user.list.delete'}
                        <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('user/list/delete')}">
                            <i class="icow icow-shanchu1"></i> 批量删除
                        </button>
                        {/if}
                    </div>
                </td>
                <td colspan="3" style="text-align: right">
                    {$pager}
                </td>
            </tr>
            </tfoot>
        </table>
    </div>
</div>
{/if}

<script language="javascript">
    {if $opencommission}
    require(['bootstrap', 'jquery', 'jquery.ui'], function (bs, $, $) {
        $("[rel=pop]").popover({
            trigger:'manual',
            placement : 'left', 
            title : $(this).data('title'),
            html: 'true', 
            content : $(this).data('content'),
            animation: false
        }).on("mouseenter", function () {
                    var _this = this;
                    $(this).popover("show"); 
                    $(this).siblings(".popover").on("mouseleave", function () {
                        $(_this).popover('hide');
                    });
                }).on("mouseleave", function () {
                    var _this = this;
                    setTimeout(function () {
                        if (!$(".popover:hover").length) {
                            $(_this).popover("hide")
                        }
                    }, 100);
                });
 
	 
	   });
	{/if}
			   
</script>
{template '_footer'}